<!DOCTYPE html>
<html>
<head>
    

    

    



    <meta charset="utf-8">
    
    
    
    <title>Cucy的博客</title>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    
    <meta name="theme-color" content="#3F51B5">
    
    
    <meta name="keywords" content="">
    <meta property="og:type" content="website">
<meta property="og:title" content="Cucy的博客">
<meta property="og:url" content="http://zhourudong.cn/page/2/index.html">
<meta property="og:site_name" content="Cucy的博客">
<meta property="og:locale" content="zh-CN">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="Cucy的博客">
    
        <link rel="alternate" type="application/atom+xml" title="Cucy的博客" href="/atom.xml">
    
    <link rel="shortcut icon" href="/favicon.ico">
    <link rel="stylesheet" href="/css/style.css?v=1.6.13">
    <script>window.lazyScripts=[]</script>

    <!-- custom head -->
    

</head>

<body>
    <div id="loading" class="active"></div>

    <aside id="menu"  >
  <div class="inner flex-row-vertical">
    <a href="javascript:;" class="header-icon waves-effect waves-circle waves-light" id="menu-off">
        <i class="icon icon-lg icon-close"></i>
    </a>
    <div class="brand-wrap" style="background-image:url(/img/brand.jpg)">
      <div class="brand">
        <a href="/" class="avatar waves-effect waves-circle waves-light">
          <img src="/img/avatar.png">
        </a>
        <hgroup class="introduce">
          <h5 class="nickname">cucy</h5>
          <a href="mailto:292016176@qq.com" title="292016176@qq.com" class="mail">292016176@qq.com</a>
        </hgroup>
      </div>
    </div>
    <div class="scroll-wrap flex-col">
      <ul class="nav">
        
            <li class="waves-block waves-effect">
              <a href="/"  >
                <i class="icon icon-lg icon-home"></i>
                主页
              </a>
            </li>
        
            <li class="waves-block waves-effect">
              <a href="/archives"  >
                <i class="icon icon-lg icon-archives"></i>
                Archives
              </a>
            </li>
        
            <li class="waves-block waves-effect">
              <a href="/tags"  >
                <i class="icon icon-lg icon-tags"></i>
                Tags
              </a>
            </li>
        
            <li class="waves-block waves-effect">
              <a href="https://github.com/cucy" target="_blank" >
                <i class="icon icon-lg icon-github"></i>
                Github
              </a>
            </li>
        
      </ul>
    </div>
  </div>
</aside>

    <main id="main">
        <header class="top-header" id="header">
    <div class="flex-row">
        <a href="javascript:;" class="header-icon waves-effect waves-circle waves-light on" id="menu-toggle">
          <i class="icon icon-lg icon-navicon"></i>
        </a>
        <div class="flex-col header-title ellipsis">Cucy的博客</div>
        
        <div class="search-wrap" id="search-wrap">
            <a href="javascript:;" class="header-icon waves-effect waves-circle waves-light" id="back">
                <i class="icon icon-lg icon-chevron-left"></i>
            </a>
            <input type="text" id="key" class="search-input" autocomplete="off" placeholder="输入感兴趣的关键字">
            <a href="javascript:;" class="header-icon waves-effect waves-circle waves-light" id="search">
                <i class="icon icon-lg icon-search"></i>
            </a>
        </div>
        
        
        <a href="javascript:;" class="header-icon waves-effect waves-circle waves-light" id="menuShare">
            <i class="icon icon-lg icon-share-alt"></i>
        </a>
        
    </div>
</header>
<header class="content-header index-header">

    <div class="container fade-scale">
        <h1 class="title">Cucy的博客</h1>
        <h5 class="subtitle">
            
                
            
        </h5>
    </div>

    


</header>

<div class="container body-wrap">

    <ul class="post-list">
    
        <li class="post-list-item fade">
            <article id="post-36-ActiveMQ-zookeeper高可用配置"
  class="article-card article-type-post" itemprop="blogPost">

    <div class="post-meta">
        <time class="post-time" title="2017-04-14 16:33:28" datetime="2017-04-14T08:33:28.000Z"  itemprop="datePublished">2017-04-14</time>

        


    </div>

    


  
    <h3 class="post-title" itemprop="name">
      <a class="post-title-link" href="/2017/04/14/36-ActiveMQ-zookeeper高可用配置/">ActiveMQ_zookeeper高可用配置</a>
    </h3>
  




    <div class="post-content" id="post-content" itemprop="postContent">

    
        ActiveMQ levelDBzookeeper主机:


主机名
ip
客户端端口
zookeeper集群端口
选leader端口




node1
10.76.249.173
2181
2881
3881


node2
10.76.249.174
2181
2881
3881


node3
10.76.249.175
2181
2881
3881



    

        <a href="/2017/04/14/36-ActiveMQ-zookeeper高可用配置/" class="post-more waves-effect waves-button">
            阅读全文…
        </a>
    </div>
    
    <div class="post-footer">
        
	<ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/activemq/">activemq</a></li></ul>

    </div>
    
</article>

        </li>
    
        <li class="post-list-item fade">
            <article id="post-35-linux-vsftpd"
  class="article-card article-type-post" itemprop="blogPost">

    <div class="post-meta">
        <time class="post-time" title="2017-03-30 15:40:57" datetime="2017-03-30T07:40:57.000Z"  itemprop="datePublished">2017-03-30</time>

        


    </div>

    


  
    <h3 class="post-title" itemprop="name">
      <a class="post-title-link" href="/2017/03/30/35-linux-vsftpd/">linux vsftpd</a>
    </h3>
  




    <div class="post-content" id="post-content" itemprop="postContent">

    
        OS : CentOS Linux release 7.2.1511 (Core)
    

        <a href="/2017/03/30/35-linux-vsftpd/" class="post-more waves-effect waves-button">
            阅读全文…
        </a>
    </div>
    
    <div class="post-footer">
        
	<ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/linux/">linux</a></li></ul>

    </div>
    
</article>

        </li>
    
        <li class="post-list-item fade">
            <article id="post-34-python-面向对象总结"
  class="article-card article-type-post" itemprop="blogPost">

    <div class="post-meta">
        <time class="post-time" title="2017-03-29 16:07:46" datetime="2017-03-29T08:07:46.000Z"  itemprop="datePublished">2017-03-29</time>

        


    </div>

    


  
    <h3 class="post-title" itemprop="name">
      <a class="post-title-link" href="/2017/03/29/34-python-面向对象总结/">python 面向对象总结</a>
    </h3>
  




    <div class="post-content" id="post-content" itemprop="postContent">

    
        类的定义构造函数def __ini__(self, ....):    pass
析构函数def __del__(self, ...):    pass    '''    当被python回收机制进行回收会自动调用这个函数    '''
    

        <a href="/2017/03/29/34-python-面向对象总结/" class="post-more waves-effect waves-button">
            阅读全文…
        </a>
    </div>
    
    <div class="post-footer">
        
	<ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/python-面向对象/">python 面向对象</a></li></ul>

    </div>
    
</article>

        </li>
    
        <li class="post-list-item fade">
            <article id="post-33-基础算法"
  class="article-card article-type-post" itemprop="blogPost">

    <div class="post-meta">
        <time class="post-time" title="2017-03-28 15:59:24" datetime="2017-03-28T07:59:24.000Z"  itemprop="datePublished">2017-03-28</time>

        


    </div>

    


  
    <h3 class="post-title" itemprop="name">
      <a class="post-title-link" href="/2017/03/28/33-基础算法/">基础算法</a>
    </h3>
  




    <div class="post-content" id="post-content" itemprop="postContent">

    
        斐波那契数列
    

        <a href="/2017/03/28/33-基础算法/" class="post-more waves-effect waves-button">
            阅读全文…
        </a>
    </div>
    
    <div class="post-footer">
        
	<ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/python-算法/">python 算法</a></li></ul>

    </div>
    
</article>

        </li>
    
        <li class="post-list-item fade">
            <article id="post-32-python装饰器"
  class="article-card article-type-post" itemprop="blogPost">

    <div class="post-meta">
        <time class="post-time" title="2017-03-28 14:40:13" datetime="2017-03-28T06:40:13.000Z"  itemprop="datePublished">2017-03-28</time>

        


    </div>

    


  
    <h3 class="post-title" itemprop="name">
      <a class="post-title-link" href="/2017/03/28/32-python装饰器/">python装饰器</a>
    </h3>
  




    <div class="post-content" id="post-content" itemprop="postContent">

    
        简单装饰器实现斐波那契数列
    

        <a href="/2017/03/28/32-python装饰器/" class="post-more waves-effect waves-button">
            阅读全文…
        </a>
    </div>
    
    <div class="post-footer">
        
	<ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/python/">python</a></li></ul>

    </div>
    
</article>

        </li>
    
        <li class="post-list-item fade">
            <article id="post-31-python-logger"
  class="article-card article-type-post" itemprop="blogPost">

    <div class="post-meta">
        <time class="post-time" title="2017-03-16 15:55:10" datetime="2017-03-16T07:55:10.000Z"  itemprop="datePublished">2017-03-16</time>

        


    </div>

    


  
    <h3 class="post-title" itemprop="name">
      <a class="post-title-link" href="/2017/03/16/31-python-logger/">python logger</a>
    </h3>
  




    <div class="post-content" id="post-content" itemprop="postContent">

    
        
    

        <a href="/2017/03/16/31-python-logger/" class="post-more waves-effect waves-button">
            阅读全文…
        </a>
    </div>
    
    <div class="post-footer">
        
	<ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/python模块/">python模块</a></li></ul>

    </div>
    
</article>

        </li>
    
        <li class="post-list-item fade">
            <article id="post-29-数据库比较"
  class="article-card article-type-post" itemprop="blogPost">

    <div class="post-meta">
        <time class="post-time" title="2017-03-03 09:51:50" datetime="2017-03-03T01:51:50.000Z"  itemprop="datePublished">2017-03-03</time>

        


    </div>

    


  
    <h3 class="post-title" itemprop="name">
      <a class="post-title-link" href="/2017/03/03/29-数据库比较/">数据库比较</a>
    </h3>
  




    <div class="post-content" id="post-content" itemprop="postContent">

    
        mysql
    

        <a href="/2017/03/03/29-数据库比较/" class="post-more waves-effect waves-button">
            阅读全文…
        </a>
    </div>
    
    <div class="post-footer">
        
	<ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/mysql/">mysql</a></li></ul>

    </div>
    
</article>

        </li>
    
        <li class="post-list-item fade">
            <article id="post-28-python-mysql连接池简略实现"
  class="article-card article-type-post" itemprop="blogPost">

    <div class="post-meta">
        <time class="post-time" title="2017-02-28 11:42:22" datetime="2017-02-28T03:42:22.000Z"  itemprop="datePublished">2017-02-28</time>

        


    </div>

    


  
    <h3 class="post-title" itemprop="name">
      <a class="post-title-link" href="/2017/02/28/28-python-mysql连接池简略实现/">python mysql连接池简略实现</a>
    </h3>
  




    <div class="post-content" id="post-content" itemprop="postContent">

    
        v1# -*- coding: utf-8 -*-# __author__ = 'zhourudong'# 连接池的实现import pymysqlimport Queuefrom pymysql.cursors import DictCursorclass ConnectionPool:    def __init__(self, **kwargs):        self.size = kwargs.pop('size', 10)  # 允许最大的连接        self.idle = kwargs.pop('idle', 3)  # 空闲连接        self.kwargs = kwargs        self.length = 0  # 已用连接        self.connections = Queue.Queue(maxsize=self.idle)    def _connect(self):  # 创建连接的函数        if not self.connections.full():  # 如果当前连接小于预留的连接则创建            conn = pymysql.connect(**self.kwargs)            self.connections.put(conn)  # 放到池中            self.length += 1        else:            raise RuntimeError('lot of connections ')    def _close(self, conn):        conn.close()  #        self.length -= 1  # 17分钟    def get(self, timeout=None):        if self.connections.empty() and self.length &lt; self.size:  # 如果连接池为空 或者已用连接小于设置连接数上限            self._connect()        return self.connections.get(timeout=timeout)    def return_resource(self, conn):        if self.connections.full():            # 如果连接池中剩余的连接大于 设置连接上线)(连接池满则关闭, 否则把连接放到连接池中)            self._close(conn)            return        self.connections.put(conn)if __name__ == '__main__':    pool = ConnectionPool(host='127.0.0.1',                          port=23316, user='root',                          password='123456',                          database='zrd',                          cursorclass=DictCursor)    for _ in range(11):        conn = pool.get()        conn.cursor()    # conn = pool.get()    # try:    #    #     with conn as cur:    #         cur.execute(""" SELECT * FROM `user`""")    #         for res in cur.fetchall():    #             print res    # finally:    #     pool.return_resource(conn)
    

        <a href="/2017/02/28/28-python-mysql连接池简略实现/" class="post-more waves-effect waves-button">
            阅读全文…
        </a>
    </div>
    
    <div class="post-footer">
        
	<ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/python/">python</a></li></ul>

    </div>
    
</article>

        </li>
    
        <li class="post-list-item fade">
            <article id="post-27-python面向对象"
  class="article-card article-type-post" itemprop="blogPost">

    <div class="post-meta">
        <time class="post-time" title="2017-02-20 10:48:22" datetime="2017-02-20T02:48:22.000Z"  itemprop="datePublished">2017-02-20</time>

        


    </div>

    


  
    <h3 class="post-title" itemprop="name">
      <a class="post-title-link" href="/2017/02/20/27-python面向对象/">python面向对象</a>
    </h3>
  




    <div class="post-content" id="post-content" itemprop="postContent">

    
        类创建
class D:    def __init__(self):        print(slef)
实例化(创建对象)
class B:    def __init__(self, a, b, c, d):        print(a)        print(b)        print(c)        print(d)        b = B(1,2,3,4)

创建对象使用 类名(init 函数除第一个参数外的参数列表)
创建对象的时候 实际执行了 init函数
首先创建对象
对象作为self参数传递给__init__函数
返回self
    

        <a href="/2017/02/20/27-python面向对象/" class="post-more waves-effect waves-button">
            阅读全文…
        </a>
    </div>
    
    <div class="post-footer">
        
	<ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/python/">python</a></li></ul>

    </div>
    
</article>

        </li>
    
        <li class="post-list-item fade">
            <article id="post-26-python文件操作"
  class="article-card article-type-post" itemprop="blogPost">

    <div class="post-meta">
        <time class="post-time" title="2017-02-18 12:25:16" datetime="2017-02-18T04:25:16.000Z"  itemprop="datePublished">2017-02-18</time>

        


    </div>

    


  
    <h3 class="post-title" itemprop="name">
      <a class="post-title-link" href="/2017/02/18/26-python文件操作/">python文件操作</a>
    </h3>
  




    <div class="post-content" id="post-content" itemprop="postContent">

    
        文件操作
                
                    
                    
                
                
            
    

        <a href="/2017/02/18/26-python文件操作/" class="post-more waves-effect waves-button">
            阅读全文…
        </a>
    </div>
    
    <div class="post-footer">
        
	<ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/python/">python</a></li></ul>

    </div>
    
</article>

        </li>
    
    </ul>

    
<nav id="page-nav">
    <div class="inner">
    <a class="extend prev" rel="prev" href="/">上一页</a><a class="page-number" href="/">1</a><span class="page-number current">2</span><a class="page-number" href="/page/3/">3</a><a class="page-number" href="/page/4/">4</a><span class="space">&hellip;</span><a class="page-number" href="/page/6/">6</a><a class="extend next" rel="next" href="/page/3/">下一页</a>
    </div>
</nav>


</div>

        <footer class="footer">
    <div class="top">
        
<p>
    <span id="busuanzi_container_site_uv" style='display:none'>
        站点总访客数：<span id="busuanzi_value_site_uv"></span>
    </span>
    <span id="busuanzi_container_site_pv" style='display:none'>
        站点总访问量：<span id="busuanzi_value_site_pv"></span>
    </span>
</p>


        <p>
            
                <span><a href="/atom.xml" target="_blank" class="rss" title="rss"><i class="icon icon-lg icon-rss"></i></a></span>
            
            <span>博客内容遵循 <a rel="license" href="https://creativecommons.org/licenses/by-nc-sa/4.0/deed.zh">知识共享 署名 - 非商业性 - 相同方式共享 4.0 国际协议</a></span>
        </p>
    </div>
    <div class="bottom">
        <p><span>cucy &copy; 2016 - 2017</span>
            <span>
                
                Power by <a href="http://hexo.io/" target="_blank">Hexo</a> Theme <a href="https://github.com/yscoder/hexo-theme-indigo" target="_blank">indigo</a>
            </span>
        </p>
    </div>
</footer>

    </main>
    <div class="mask" id="mask"></div>
<a href="javascript:;" id="gotop" class="waves-effect waves-circle waves-light"><span class="icon icon-lg icon-chevron-up"></span></a>



<div class="global-share" id="globalShare">
    <ul class="reset share-icons">
      <li>
        <a class="weibo share-sns" target="_blank" href="http://service.weibo.com/share/share.php?url=http://zhourudong.cn/page/2/&title=Cucy的博客&pic=http://zhourudong.cn/img/avatar.png" data-title="微博">
          <i class="icon icon-weibo"></i>
        </a>
      </li>
      <li>
        <a class="weixin share-sns wxFab" href="javascript:;" data-title="微信">
          <i class="icon icon-weixin"></i>
        </a>
      </li>
      <li>
        <a class="qq share-sns" target="_blank" href="http://connect.qq.com/widget/shareqq/index.html?url=http://zhourudong.cn/page/2/&title=Cucy的博客&source=" data-title=" QQ">
          <i class="icon icon-qq"></i>
        </a>
      </li>
      <li>
        <a class="facebook share-sns" target="_blank" href="https://www.facebook.com/sharer/sharer.php?u=http://zhourudong.cn/page/2/" data-title=" Facebook">
          <i class="icon icon-facebook"></i>
        </a>
      </li>
      <li>
        <a class="twitter share-sns" target="_blank" href="https://twitter.com/intent/tweet?text=Cucy的博客&url=http://zhourudong.cn/page/2/&via=http://zhourudong.cn" data-title=" Twitter">
          <i class="icon icon-twitter"></i>
        </a>
      </li>
      <li>
        <a class="google share-sns" target="_blank" href="https://plus.google.com/share?url=http://zhourudong.cn/page/2/" data-title=" Google+">
          <i class="icon icon-google-plus"></i>
        </a>
      </li>
    </ul>
 </div>


<div class="page-modal wx-share" id="wxShare">
    <a class="close" href="javascript:;"><i class="icon icon-close"></i></a>
    <p>扫一扫，分享到微信</p>
    <img src="//api.qrserver.com/v1/create-qr-code/?data=http://zhourudong.cn/page/2/" alt="微信分享二维码">
</div>




    <script src="//cdn.bootcss.com/node-waves/0.7.4/waves.min.js"></script>
<script>
var BLOG = { ROOT: '/', SHARE: true, REWARD: false };


</script>

<script src="/js/main.min.js?v=1.6.13"></script>


<div class="search-panel" id="search-panel">
    <ul class="search-result" id="search-result"></ul>
</div>
<template id="search-tpl">
<li class="item">
    <a href="{path}" class="waves-block waves-effect">
        <div class="title ellipsis" title="{title}">{title}</div>
        <div class="flex-row flex-middle">
            <div class="tags ellipsis">
                {tags}
            </div>
            <time class="flex-col time">{date}</time>
        </div>
    </a>
</li>
</template>

<script src="/js/search.min.js?v=1.6.13" async></script>






<script async src="//dn-lbstatics.qbox.me/busuanzi/2.3/busuanzi.pure.mini.js"></script>



<script>
(function() {
    var OriginTitile = document.title, titleTime;
    document.addEventListener('visibilitychange', function() {
        if (document.hidden) {
            document.title = '死鬼去哪里了！';
            clearTimeout(titleTime);
        } else {
            document.title = '(つェ⊂)咦!又好了!';
            titleTime = setTimeout(function() {
                document.title = OriginTitile;
            },2000);
        }
    });
})();
</script>



</body>
</html>
